﻿#ifndef EMOTIONRESOURCE_H
#define EMOTIONRESOURCE_H

#include <QMap>
#include <QPixmap>
#include "globalinstance.h"

struct Emotion
{
    Emotion() {}
    static const QSize size;
    QPixmap pixmap;
    QString name;
    QString fileName;
};

class EmotionResource : public GlobalInstance<EmotionResource>
{
    friend class GlobalInstance<EmotionResource>;
    EmotionResource();
public:
    QMap<int, Emotion>::const_iterator constBegin() const
    {
        return emotions.first.constBegin();
    }
    QMap<int, Emotion>::const_iterator constEnd() const
    {
        return emotions.first.constEnd();
    }
    int size() const
    {
        return emotions.first.size();
    }
    bool containsName(const QString &name) const;
    QPixmap findByFileName(const QString &fileName) const;
    QPixmap findByName(const QString &name) const;
private:
    const QPair<QMap<int, Emotion>, QHash<QString, int>> emotions;
};

#endif // EMOTIONRESOURCE_H
